//
//  ListTableViewCell3.m
//  HimalayaMusic
//
//  Created by dllo on 16/1/7.
//  Copyright © 2016年 WXCLegendary. All rights reserved.
//

#import "ListTableViewCell3.h"

@implementation ListTableViewCell3

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViews = [[UIImageView alloc] init];
        self.personLabel = [[UILabel alloc] init];
        self.tracksLabel = [[UILabel alloc] init];
        self.titleLabel = [[UILabel alloc] init];
        
        [self addSubview:self.imageViews];
        [self addSubview:self.personLabel];
        [self addSubview:self.tracksLabel];
        [self addSubview:self.titleLabel];
        
    }
    return self;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageViews.frame = CGRectMake(20, 5, self.height - 20, self.height - 10);
    self.titleLabel.frame = CGRectMake(self.imageViews.origin.x + self.imageViews.width + 5, 5, self.width - 20 - self.imageViews.width - 20, (self.height - 20) / 3 );
    self.titleLabel.font = [UIFont systemFontOfSize:14];
    
    self.personLabel.frame = CGRectMake(self.titleLabel.origin.x, self.titleLabel.origin.y + self.titleLabel.height, self.titleLabel.width, self.titleLabel.height);
    self.personLabel.font = [UIFont systemFontOfSize:12];
    self.personLabel.textColor = [UIColor grayColor];
    
    self.tracksLabel.frame = CGRectMake(self.personLabel.origin.x, self.personLabel.origin.y + self.personLabel.height, self.titleLabel.width, self.personLabel.height);
    self.tracksLabel.font = [UIFont systemFontOfSize:12];
    self.tracksLabel.textColor = [UIColor grayColor];
}

-(void)setModel:(listModel3 *)model {
    if (_model != model) {
        _model = model;
    }
    [self.imageViews sd_setImageWithURL:[NSURL URLWithString:model.middleLogo]];
    
    self.titleLabel.text = model.nickname;
    self.personLabel.text = model.personDescribe;
    
    self.tracksLabel.text = [NSString stringWithFormat:@"粉丝:%@",[HeperTools SharePlayCount:[model.tracksCounts intValue]] ];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
